class Calculation {
    constructor(val) {
        this.data = val;
    }

    add(val) {
        Array.prototype.splice.call(val);
        return function () {
            val + this.data;
        }
    }

    sub(val) {
        return new Promise((resolve, reject) => {
            resolve(this.data - val);
        });
    }

    divide(val) {
        return new Promise((resolve, reject) => {
            resolve((this.data / val).tofixed());
        });
    }

    mul(val) {
        return new Promise((resolve, reject) => {
            resolve(this.data * val);
        });


    }
    calculate() {
        return this.data;
    }

}

// Number.prototype.add = function (n) {
//     return this.valueOf() + n;
// };
// Number.prototype.minus = function (n) {
//     return this.valueOf() - n;
// };

const temp = new Calculation(0);

console.log(temp.add(3).add(5).calculate());

